package com.letv.app.ljodfh.ui.presenter;

import com.letv.app.ljodfh.beans.TvLivingList;
import com.letv.app.ljodfh.ui.contract.ChannelContract;
import com.letv.app.ljodfh.ui.model.ChannelModel;

/**
 * @author suming
 * @date 2020/4/15 9:31
 */
public class ChannelPresenter implements ChannelContract.Presenter {
    private ChannelContract.Model model;
    private ChannelContract.View view;

    public ChannelPresenter(ChannelContract.View view) {
        this.view = view;
        this.model = new ChannelModel();
    }

    ///////////////////// 拉取远程数据 //////////////////////////////

    @Override
    public void fetchData() {
        model.fetchData(view.getUrl(), this);
    }

    ///////////////////// 远程数据拉取回调 //////////////////////////////////

    @Override
    public void onStart() {

    }

    @Override
    public void onComplete() {
        view.onComplete();
    }

    @Override
    public void onError(String error) {
        view.onError(error);
    }

    @Override
    public void getData(TvLivingList data) {
        view.renderData(data);
    }

}
